package cn.wjssl.infrastructure.persistent.dao;

import cn.bugstack.middleware.db.router.annotation.DBRouter;
import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy;
import cn.wjssl.infrastructure.persistent.po.RaffleActivityAccountPO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 抽奖活动账户
 */
@Mapper
public interface IRaffleActivityAccountDao {

    void insert(RaffleActivityAccountPO accountPO);

    int updateAccountQuota(RaffleActivityAccountPO accountPO);

    // 更新总库存
    int updateActivityAccountSubtractionQuota(RaffleActivityAccountPO accountPO);

    // 更新月库存镜像
    int updateActivityAccountMonthSurplusImageQuota(RaffleActivityAccountPO accountPO);

    // 更新日库存镜像
    int updateActivityAccountDaySurplusImageQuota(RaffleActivityAccountPO accountPO);

    // 根据 userId, activityId 查询 account 实体
    @DBRouter
    RaffleActivityAccountPO queryActivityAccountByUserId(RaffleActivityAccountPO accountPO);

    // 根据 userId, activityId 查询 account 实体, 用于手动定义分库路由场景
    RaffleActivityAccountPO queryAccount(RaffleActivityAccountPO accountPO);
}
